<?php
class Blockarea extends AppModel {
    var $name = 'Blockarea';
    var $primaryKey = 'name';
    
    var $hasMany=array(
        'Block'=>array(
            'className'=>'Block',
            'foreignKey'=>'blockarea_name',
            'conditions' => 'Block.status = "active"',
            'order' => 'Block.order',
        ),
        
        
    );
    
    var $validate = array(
        
        'name' => array(
            'notEmpty' => array(
                'rule' => array('notEmpty'),
                'required' => true,
                'message' => 'This field is required'
            ),
            'unique' => array(
                'rule' => array('isUnique'),
                'message' => 'This name has already exists'
            ),
            'no_space' => array(
                'rule' => array('custom','/^[a-z0-9]{3,}$/i'),
                'message' => 'Only letters and integers, min 3 characters' 
            )
            
        ),
              
    );
   
    
    
    
}    
?>